package com.huiminpay.merchant.mapper;

import com.huiminpay.merchant.entity.Staff;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ysp
 * @since 2021-07-23
 */
@Mapper
public interface StaffMapper extends BaseMapper<Staff> {


    /**
     * 查询当前商户下员工用户名或手机号是否唯一
     * @param merchantId
     * @param username
     * @param mobile
     * @return
     */
    @Select("select count(*) from staff " +
            "where MERCHANT_ID = #{merchantId} " +
            "and (USERNAME = #{username} or MOBILE = #{mobile})")
    Integer queryUsernameAndMobile(@Param("merchantId") Long merchantId,
                                   @Param("username") String username,
                                   @Param("mobile") String mobile);
}
